<?php
/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController,
	Zend\View\Model\ViewModel,
	Doctrine\ORM\EntityManager,
	Application\Entity\User;

class IndexController extends AbstractActionController
{
	public function indexAction()
    {
        return new ViewModel();
    }
	
	
	public function createAction()
	{
		/* @var $objectManager EntityManager */
		$objectManager = $this
			->getServiceLocator()
			->get('Doctrine\ORM\EntityManager');

//		$user = new User();
//		$user->setFullName('Ivan Ghaniball');
//		$objectManager->persist($user);
//		
//		$user2 = new User();
//		$user2->setFullName('Michaël Gallego');
//		$objectManager->persist($user2);
//
//		$user3 = new User();
//		$user3->setFullName('Kyle Spraggs');
//		$objectManager->persist($user3);
//		
//		$objectManager->flush();
		
		
		$query = $objectManager->createQuery('SELECT u FROM Application\Entity\User u WHERE u.id = 1');
		var_dump($query->getResult());
	//	var_dump($objectManager->getRepository('Application\Entity\User')->findAll());
		die('done');
	//	die(var_dump($user->getId())); // yes, I'm lazy
	}
}
